package com.example.mapper;

import com.example.entity.ZyzActivity;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 志愿活动Mapper
 */
public interface ZyzActivityMapper {
    /**
     * 根据活动名称查询
     * @param name
     * @return
     */
    @Select("select * from zyz_activity where name = #{name}")
    ZyzActivity selectByName(String name);

    /**
     * 新增
     * @param zyzActivity
     */
    int insert(ZyzActivity zyzActivity);

    /**
     * 批量删除
     * @param toStrArray
     * @return
     */
    int deleteBatch(String[] toStrArray);

    /**
     * 修改
     * @param zyzActivity
     */
    int updateById(ZyzActivity zyzActivity);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select a.*,c.name as collegeName from zyz_activity a left join college c on a.organizer = c.id where a.id =#{id}")
    ZyzActivity selectById(Integer id);

    /**
     * 查询所有
     * @param zyzActivity
     * @return
     */
    List<ZyzActivity> selectAll(ZyzActivity zyzActivity);

    /**
     * 查询总数
     * @return
     */
    @Select("select count(*) from zyz_activity")
    Integer selectCount();

    List<Map<String, Object>> selectCollegeCount();

}
